package org.hive.testserver.domain.util;

import org.apache.commons.lang.StringUtils;
import org.hive.testserver.domain.model.Entity;

public class IdBuilder {

	private String id = "";
	
	public IdBuilder() {
		super();
	}
	
	public IdBuilder withName(String name) {
		if (id.length() > 0) {
			id = id += IdParser.ID_COMPONENT_SEPARATOR;
		}
		id += StringUtils.trim(name);
		return this;
	}
	
	public String toId() {
		return id;
	}

	public IdBuilder withEntity(Entity entity) {
		return withName(entity.getId());
	}
	
}
